<template>
  <view class="indexContent" :class="isBuyCoupon?'lockScroll':''">
    <image :src="`${uniConfig.ssoPath + bgAcitve.value}`" v-if="bgAcitve.value" style="width:100%;" mode="widthFix"/>
    <image class="submitBt" src="https://images.sijiyoufu.com/static/imgs/project/new_join1.png?v=001100" @click="popupRef.open()" mode="widthFix"/>
	<image class="submitBt1" src="https://images.sijiyoufu.com/static/imgs/project/new_join2.png?v=001111" @click="navigateToMovie1" mode="widthFix"/>
    <!-- popupRef.open() -->
    <uv-popup ref="popupRef" round="12" mode="bottom" 
            custom-style="height: 72vh;" 
            bgColor="#f5f5f5" 
            @change="toggleMask"
            :closeable="true"
            closeIconPos="top-right">
            <buyCoupon v-if="isBuyCoupon" :isLink="true"/>
		</uv-popup>
    <Tabbar index="0"/>
  </view>
</template>

<script setup lang="ts">
const app = getApp()
import { ref , getCurrentInstance} from 'vue'
import { useUCenterStore } from '@/stores/uCenter'
import Tabbar from '@/components/tabbar'
import buyCoupon from '@/components/power/team.vue'
import { getActive } from "@/api/product"
import { onLoad ,onShow,onShareAppMessage,onShareTimeline} from "@dcloudio/uni-app"

import { uniConfig } from '@/config/index'
const bgAcitve = ref<any>({})
const popupRef = ref()
const isBuyCoupon = ref<any>(false)
const toggleMask = (e : any) => {
  isBuyCoupon.value = e.show
}
const movieId = ref<any>('')
const navigateToMovie = () => {
   // uni.showToast({icon:'none',title:`还未开始，敬请期待`})
  uni.reLaunch({
    url: '/pages/movie/teamshow'
  })
}

const navigateToMovie1 = () => {
  // uni.showToast({icon:'none',title:`还未开始，敬请期待`})
  uni.reLaunch({
    url: '/pages/movie/index'
  })
}
const isIndex = ref<boolean>(false)
const getActiveInfo = () => {
  uni.setStorageSync('city',{})
  uni.setStorageSync('county',{})
  uni.setStorageSync('localtag',{})
  getActive({ztTag : 'wzry'}).then(res => {
    res.data.forEach(item => {
      if(item.key == 'bgPicture'){
        bgAcitve.value = item
        uni.setStorageSync('bg',item.value)
      }
      if(item.key == 'movieIds'){
        uni.setStorageSync('movieId',item.value)
      }
    })
  })
}
onLoad(async (options : any) => {
  const { proxy } = getCurrentInstance();
  await proxy.$onLaunched;
  isIndex.value = true
  getActiveInfo()
  
})

onShow(() => {
  isIndex.value && getActiveInfo()
})
onShareAppMessage(() => {
		return {
			title:'邀你一起体验影院观赛',
			path:'/pages/index/index'
		}
})
	
onShareTimeline(() => {
  return {
    title:'邀你一起体验影院观赛',
    path:'/pages/index/index'
  }
});
</script>

<style lang="scss">
page{
  background-position: 0 -12.5vh !important;
  background-size: 100% 206%;
  background-image: none !important;
}
.lockScroll{
  overflow: hidden;
	position: fixed;
}
.indexContent {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width:100%;
}
.submitBt{
  position: fixed;
  bottom: 20%;
  width: 58%;
  left: 21%;
}
.submitBt1{
  position: fixed;
  bottom: 12%;
  width: 58%;
  left: 21%;
}
</style>
